package com.qf.controller;

import com.github.pagehelper.PageInfo;
import com.qf.entity.SystemMnue;
import com.qf.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.HashMap;
import java.util.List;

/**
 * 2019/11/29
 * 郭程鹏
 * gcp1909
 * 面向代码面向君,不负时光不负卿
 */

@Controller
public class MenuController {

    @Autowired
    private MenuService  menuService;

    @RequestMapping("/resource/demo8/list")
    public String selectAll(Model model,String menuName,Integer menuStatus,Integer page){
        if (page==null){
            page=1;
        }
        HashMap<Object, Object> map = new HashMap<>();
        map.put("mnueName",menuName);
        map.put("mnueStatus",menuStatus);
        PageInfo<SystemMnue> pageInfo = menuService.allMenu(map, page);
        model.addAttribute("pageInfo",pageInfo);
        model.addAttribute("menuStatus",menuStatus);
        model.addAttribute("menuName",menuName);

        return "resource/demo8/list";
    }
}
